Skip to content

Instantly share code, notes, and snippets.

View GavinRay97's full-sized avatar

Gavin Ray GavinRay97

View GitHub Profile
@blister
blister / gist:740829
Created December 14, 2010 18:19
Bash script to add a delay to the localhost interface on Linux machines
#!/bin/bash
# Copyright 2010 Eric Ryan Harrison <me@ericharrison.info>
# Inspired by:
# http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
if [ -n "$1" ]
then
if [ "$1" = "off" ]
then
tc qdisc del dev lo root
@huitseeker
huitseeker / mindeps.py
Created December 28, 2010 19:10
Minimizes a list of debian packages by removing those implied as dependencies of the others
#!/usr/bin/python
#######################################################################
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License as #
# published by the Free Software Foundation; either version 2 of the #
# License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
@minimum2scp
minimum2scp / debtree-web.rb
Last active November 27, 2022 19:29
A web interface for debtree, apt-cache dotty using sinatra (ruby)
#! /usr/bin/env ruby
# -*- coding: utf-8; -*-
##
## debtree と apt-cache dotty の web インターフェース
## (コマンドラインオプション覚えてられない)
##
## apt-cache dotty については apt-cache(8) を参照
## debtree については以下のサイトを参照
## http://collab-maint.alioth.debian.org/debtree/index.html
@damphat
damphat / apt-rdepends-tree
Last active December 16, 2023 01:38
debian dependency tree
#! /bin/bash
# Description: show dependency tree
# Author: damphat
if [ $# != 1 ]; then
echo 'Usage: apt-rdepends-tree <package>'
echo 'Required packages: apt-rdepends'
exit 1
fi
#! /bin/bash
# Description: show dependency tree
# Author: damphat
if [ $# -lt 1 ]; then
echo 'Usage: apt-rdepends-tree [-r] <package>'
echo 'Required packages: apt-rdepends'
exit 1
fi

CLang optimizations on Mac OSX

Version:

Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

This was made with commands:

@SteveBate
SteveBate / linq.scala
Last active July 15, 2022 21:32
Scala LINQ equivalents
// http://stackoverflow.com/questions/8104846/chart-of-ienumerable-linq-equivalents-in-scala
xs.Aggregate(accumFunc) -> xs.reduceLeft(accumFunc)
xs.Aggregate(seed, accumFunc) -> xs.foldLeft(seed)(accumFunc)
xs.Aggregate(seed, accumFunc, trans) -> trans(xs.foldLeft(seed)(accumFunc))
xs.All(pred) -> xs.forall(pred)
xs.Any() -> xs.nonEmpty
xs.Any(pred) -> xs.exists(pred)
xs.AsEnumerable() -> xs.asTraversable // roughly
xs.Average() -> xs.sum / xs.length
@PieterScheffers
PieterScheffers / mysql_get_last_updated_id.sql
Created June 21, 2016 10:56
MySQL - Get id of updated rows
# http://stackoverflow.com/questions/1388025/how-to-get-id-of-the-last-updated-row-in-mysql
# single row update
SET @update_id := 0;
UPDATE some_table SET column_name = 'value', id = (SELECT @update_id := id)
WHERE some_other_column = 'blah' LIMIT 1;
SELECT @update_id;
# Multiple rows updated
SET @uids := null;
@kotarou3
kotarou3 / find-top-level-packages.py
Last active December 19, 2023 16:41
Find top-level packages of the dependency graph for debian packages
#!/usr/bin/python3
import argparse, sys
import apt
import networkx as nx
parser = argparse.ArgumentParser(
description = "Find top-level packages of the dependency graph"
)
parser.add_argument(
@timmolderez
timmolderez / pom.xml
Last active May 2, 2024 05:24
Adding dependencies to local .jar files in pom.xml
If you'd like to use a .jar file in your project, but it's not available in any Maven repository,
you can get around this by creating your own local repository. This is done as follows:
1 - To configure the local repository, add the following section to your pom.xml (inside the <project> tag):
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>