Skip to content

Instantly share code, notes, and snippets.

View infertux's full-sized avatar
:shipit:

Cédric Félizard infertux

:shipit:
View GitHub Profile
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@zach-klippenstein
zach-klippenstein / ChangePassword.java
Last active April 3, 2024 18:04
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall (rsdio@metastatic.org), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 12, 2024 03:46
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@infertux
infertux / hockeypuck.deb.sh
Created May 28, 2022 04:57
Script to build Hockeypuck .deb package using Docker
#!/bin/bash
set -euxo pipefail
cd "$(dirname "$0")"
target="${1:-hockeypuck}"
interactive="${2:-}"
container=${target}-builder
volume=/root/HOST
@ryanb
ryanb / abilities.rb
Created September 15, 2012 19:23
How you can break up large Ability class in CanCan
module Abilities
def self.ability_for(user)
if user.admin?
AdminAbility.new(user)
else user
MemberAbility.new(user)
else
GuestAbility.new
end
end
@infertux
infertux / rubocop.yml
Last active October 12, 2017 01:17
My curated Rubocop config
# See https://github.com/bbatsov/rubocop
# Add this to the top of your .rubocop.yml:
# inherit_from:
# - https://gist.githubusercontent.com/infertux/cdd2ccc6e0a0cd94f458/raw
# AllCops
AllCops:
TargetRubyVersion: 2.3
@infertux
infertux / rrd-dump.sh
Created December 19, 2016 12:06
Bash scripts to export/import RRD files for Collectd
#!/bin/bash -eu
cd /var/lib/collectd/rrd/$HOST
for f in $(find -name *.rrd); do
echo "rrdtool dump $f"
rrdtool dump $f > ${f%.rrd}.xml
done
rsync -avz --exclude *.rrd /var/lib/collectd/rrd/$HOST/ $COLLECTD_HOST:/var/lib/collectd/rrd/$HOST/
(2 * 2 * 5 * 7 * 37 * 149 * 5417 * 148781 * 51939996061871).to_s(16).scan(/../).map { |x| x.hex.chr }.join