Skip to content

Instantly share code, notes, and snippets.

@konstantint
konstantint / Program.cs
Last active October 27, 2022 15:36
A program for adding ten numbers
// Source code for the post:
// https://www.quora.com/Can-you-write-a-program-for-adding-10-numbers/answer/Konstantin-Tretyakov
// http://fouryears.eu/2018/03/17/a-program-for-adding-10-numbers/
//
// Runs with the following config.xml:
// <Config>
// <InputProvider class="Enterprise.NumberSequenceProvider"/>
// <OutputConsumer class="Enterprise.PeanoNumberPrinter"/>
// <Solution class="Enterprise.TenNumberAddingSolution">
// <Strategy class="Enterprise.AdditionStrategy"/>
@managedkaos
managedkaos / azlyrics.py
Created August 1, 2017 04:29
Scrape lyrics from azlyrics.com
import requests
from bs4 import BeautifulSoup
url = "http://www.azlyrics.com/lyrics/onyx/bacdafucup.html"
print "Default request (it will fail)..."
# make the default request
try:
r = requests.get(url)
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@luiscape
luiscape / install_packages.sh
Created January 16, 2017 14:36
Install Python dependency packages from requirements.txt using conda.
#
# Original solution via StackOverflow:
# http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t
#
#
# Install via `conda` directly.
# This will fail to install all
# dependencies. If one fails,
# all dependencies will fail to install.
@akumaf
akumaf / responsive-gists.scss
Last active February 10, 2019 03:10
See http://arevico.com/make-github-gists-more-responsive for information on how to use this gist
/**
* The following code will make a github embedded gists reponsive
* The gist will be 100% in width width, and scroll if a line is to long
* if you want wrapping, uncomment the wrapping section
* Do note that identation may be butcherd tough
*/
.gist{
width:100%;
@ofaurax
ofaurax / modinverse.py
Created March 30, 2016 15:04
Modular Inverse for RSA in python
#!/usr/bin/env python3
p = 61
q = 53
n = p*q
phi = (p-1)*(q-1)
# Took from SO
def egcd(a, b):
@vinyll
vinyll / bower.json
Last active March 16, 2018 17:10
Polymer dynamically add marker.
{
"name": "polymer-test",
"version": "0.0.1",
"authors": [
"Vincent Agnano"
],
"license": "MIT",
"dependencies": {
"polymer": "Polymer/polymer#^1.0",
"google-map": "GoogleWebComponents/google-map#~1.0"
@kylefrost
kylefrost / HOWTO.md
Last active July 31, 2021 19:24
How-To: Tweet All Commit Messages

Creating the post-commit file

Note: If you want to use your personal Twitter account to post commits, go to Step 2

  1. Create a new Twitter account for your commit messages. Example
  2. Go to http://dev.twitter.com and Sign In with your Twitter account you are posting commit messages to.
  3. Hover over your username in the top-right corner after signing in and select "My Applications"
  4. Create a new application
  5. The name, description, and site can all be whatever you want, but leave Callback URL empty
  6. Under "Application Settings" click "modify app permissions" next to "Access level"
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 23, 2024 23:26
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@heathcliff
heathcliff / getHashParam.js
Last active September 16, 2023 14:54
getHashParam(), updateHashParam(), getParam()
function getHashParam(name) {
var regex = new RegExp("(#)("+name+")(\=)([^#]*)"),
matches = [];
matches = regex.exec(window.location.hash);
if (matches !== null && matches.length > 4 && matches[4] !== null) {
return matches[4];
} else {
return false;
}
}