Skip to content

Instantly share code, notes, and snippets.

View Pysis868's full-sized avatar
💭
everything at once

Pysis Pysis868

💭
everything at once
View GitHub Profile
@bobthecow
bobthecow / tab.bash
Last active November 10, 2023 08:47
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
@kentbrew
kentbrew / favicon-interceptor.js
Created January 3, 2011 19:32
How to short-circuit those annoying favicon requests in node.js
// early experiments with node had mysterious double requests
// turned out these were for the stoopid favicon
// here's how to short-circuit those requests
// and stop seeing 404 errors in your client console
var http = require('http');
http.createServer(function (q, r) {
// control for favicon
@juggy
juggy / call_template.rb
Created May 17, 2011 19:25
Render a complete page in rails 3 without controller
# create the template
template = PageOfflineTemplate.new
template.quote = quote
template.pages = quote.build_pages
# Here I render a template with layout to a string then a PDF
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml")
@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 31, 2024 14:26 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@program247365
program247365 / QuakeConsole.ahk
Created March 11, 2012 03:59
Console 2 Settings File and Quake Awesomeness
; Change your hotkey here
^1::
DetectHiddenWindows, on
IfWinExist ahk_class Console_2_Main
{
IfWinActive ahk_class Console_2_Main
{
WinHide ahk_clasas Console_2_Main
WinActivate ahk_class Shell_TrayWnd
@scpike
scpike / open_cookie.rb
Created June 28, 2012 00:04
Rails 3 cookie decode
@davask
davask / htmlEncode.js
Last active May 19, 2020 18:26
Name : htmlEncode("text"), htmlDecode("text") - Language : JavaScript, jQuery - type : function - platform : generic
// http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding?answertab=votes#tab-top
function htmlEncode(value){
"use strict";
//create a in-memory div, set it's inner text(which jQuery automatically encodes)
//then grab the encoded contents back out. The div never exists on the page.
return $('<div/>').text(value).html();
}
function htmlDecode(value){
"use strict";
@barrucadu
barrucadu / xkcd.c
Last active December 15, 2015 16:19
HackSoc's attempt on the XKCD challenge
/* This needs the Skein functions from the NIST distribution. You can
* get the zip file from http://www.schneier.com/skein.html ("Source
* code and test vectors for Skein and Threefish (12 MB)"), and then
* you need to stick the contents of NIST/CD/Reference_Implementation
* in the same directory as this file.
*
* Compile with clang -std=c99 *.c -lcurl -lpthread -O3 -o xkcd-skein
*/
#include <time.h>
@hoylen
hoylen / getopt-example.sh
Last active July 23, 2020 11:59
Portable getopt argument processing in shell scripts. Detects which version of getopt is installed. When available, it uses GNU enhanced getopt to support long option names and whitespaces in arguments. Otherwise, defaults to using the original getopt.
#!/bin/sh
#
# Example showing use of getopt detection and use of GNU enhanced getopt
# to handle arguments containing whitespace.
#
# Written in 2004 by Hoylen Sue <hoylen@hoylen.com>
#
# To the extent possible under law, the author(s) have dedicated all copyright and
# related and neighboring rights to this software to the public domain worldwide.
# This software is distributed without any warranty.
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote