Skip to content

Instantly share code, notes, and snippets.

View jlengrand's full-sized avatar
💭
Compiling

julien Lengrand-Lambert jlengrand

💭
Compiling
View GitHub Profile
@jlengrand
jlengrand / spotiProxy
Created April 22, 2018 17:45
Activating / Deactivating Spotify proxy settings
#!/bin/sh
ON_OFF=$1
SPOTIFY_PREFS="$HOME/Library/Application Support/Spotify/prefs"
PROXY_ON="network.proxy.mode=2" #HTTP Proxy
PROXY_OFF="network.proxy.mode=1" #No proxy
if [ ! -f "$SPOTIFY_PREFS" ]; then
echo "Spotify preference file not found. Exiting"
exit 1
@gricard
gricard / webpack4upgrade.md
Last active February 29, 2024 20:23
Just some notes about my attempt to upgrade to webpack 4

If you enjoyed reading this, I'm intending to do more blogging like this over here: https://cdgd.tech

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
@focusaurus
focusaurus / A.elm
Created December 5, 2016 00:26
Decode JSON string enum into elm union type
module A exposing (..)
import Json.Decode as JD
import Json.Encode as JE
type alias User =
{ id : Int
, theme : Theme
}
@rtfpessoa
rtfpessoa / lazy-load-nvm.sh
Created August 26, 2016 11:42
NVM lazy loading script
#!/bin/bash
#
# NVM lazy loading script
#
# NVM takes on average half of a second to load, which is more than whole prezto takes to load.
# This can be noticed when you open a new shell.
# To avoid this, we are creating placeholder function
# for nvm, node, and all the node packages previously installed in the system
# to only load nvm when it is needed.
@logrusorgru
logrusorgru / mysql.sql
Last active January 16, 2024 07:01
SQL: uniqueness, automatic created_at, updated_at refresh + soft delete. SQLite, PostgreSQL, MySQL
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
-- mysql --
-- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- mysql <http://sqlfiddle.com/#!9/91afb5/2>
-- note: sqlfiddle is very stupid
@protrolium
protrolium / ffmpeg.md
Last active April 8, 2024 11:49
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@fohlin
fohlin / forms.py
Created January 8, 2011 18:50
A version of Django's UserCreationForm that uses email instead of username, with some nifty features. (Maybe not super robust yet, in terms of concurrency...)
import re
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class UniqueUserEmailField(forms.EmailField):
"""
An EmailField which only is valid if no User has that email.
"""
def validate(self, value):