Skip to content

Instantly share code, notes, and snippets.

View marzocchi's full-sized avatar

Federico Marzocchi marzocchi

View GitHub Profile
@marzocchi
marzocchi / config.nix
Last active June 23, 2021 21:44
.config/nixpkgs/config.nix
# - list packages
# nix-env -qaP
#
# - install packages in this file, or update packages after channel update:
# nix-env -iA nixpkgs.myPackages
#
# - update package list
# nix-channel --update
{
allowUnfree = true;
@marzocchi
marzocchi / zshrc
Last active November 27, 2022 17:32
zshrc
# vim: se filetype=zsh
# zmodload zsh/zprof
autoload -U add-zsh-hook
export LANG=en_US.UTF-8
TZ="Europe/Berlin"
HISTFILE=$HOME/.zhistory
HISTSIZE=3000
SAVEHIST=3000
@tabiodun
tabiodun / Dockerfile
Last active April 24, 2018 21:33
Dockerfile for tabiodun/selenium-chrome-headless
FROM selenium/node-base:3.4.0-dysprosium
USER root
ARG CHROME_VERSION="google-chrome-beta"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update -qqy \
&& apt-get -qqy install \
@nestserau
nestserau / AtomicInteger.swift
Last active October 6, 2022 12:12
Atomic way to operate on integers in Swift. Inspired by Java's AtomicInteger
/// This is free and unencumbered software released into the public domain.
///
/// Anyone is free to copy, modify, publish, use, compile, sell, or
/// distribute this software, either in source code form or as a compiled
/// binary, for any purpose, commercial or non-commercial, and by any
/// means.
///
/// In jurisdictions that recognize copyright laws, the author or authors
/// of this software dedicate any and all copyright interest in the
/// software to the public domain. We make this dedication for the benefit
@ijansch
ijansch / jsonarrayfun.php
Last active August 29, 2015 14:05
2 common issues in php based apis
<?php
// Issue 1, empty associative arrays (dictionaries) become regular arrays.
$dictionary = array('key' => 'value');
var_dump(json_encode($dictionary)); // gives '{"key":"value"}';
unset($dictionary['key']);
var_dump(json_encode($dictionary)); // Gives '[]' -> json dictionary turned into array
@notFloran
notFloran / php-amqp.sh
Last active March 26, 2016 21:00
Install amqp extension for php - Debian 7
#!/bin/sh
apt-get install php5-dev make cmake php-pear
git clone git://github.com/alanxz/rabbitmq-c.git && cd rabbitmq-c
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
cmake --build . --target install
@Hexcles
Hexcles / stylish-font-replacement.css
Last active January 2, 2022 03:35
Font substitute CSS for web pages
/*
* Replace ugly Chinese bitmap fonts with system default sans-serif.
* ATTENTION: this will intentionally change the appearance of web pages!
* Most Chinese websites do not mean to use serif fonts, especially for these ugly ones.
*/
@font-face {
font-family: "宋体";
src: local("sans-serif");
}
@istepanov
istepanov / gist:3950977
Created October 25, 2012 07:00
Remove PHPStorm settings from Mac OS X 10.8 Mountain Lion
#!/usr/bin/sh
rm -rf "$HOME/Library/Preferences/WebIde40"
rm -rf "$HOME/Library/Caches/WebIde40"
rm -rf "$HOME/Library/Application Support/WebIde40"
rm -rf "$HOME/Library/Logs/WebIde40"
@nateware
nateware / gist:3915757
Created October 19, 2012 01:27
Start Mac VNC server from command line
# Step 1: Set priveleges
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
Starting...
Setting allow all users to YES.
Setting all users privileges to 1073742079.
Done.
# Step 2: Allow VNC clients
@suprememoocow
suprememoocow / intercept.js
Created May 29, 2012 09:53
AJAX timing interceptor: this class intercepts all AJAX calls and records the time taken for the HTTP request to complete. These timings are posted back to the server in batches, if there are any to send, about every two seconds. Tested in Firefox, Chrome
(function(XHR) {
"use strict";
var stats = [];
var timeoutId = null;
var open = XHR.prototype.open;
var send = XHR.prototype.send;