Skip to content

Instantly share code, notes, and snippets.

epicserve / ubuntu-server-django-guide.rst
Last active Nov 27, 2021
Ubuntu Server Setup Guide for Django Websites
max-kov /
Last active Nov 21, 2021
matrix falling code in python using pygame
import pygame, pygame.font
import random
def IsWritten():
defTemp = True
for x in xrange((lettersOnScreen[0] / 2) - (len(str) / 2), (lettersOnScreen[0] / 2) + (len(str) / 2) + 1):
if xHeads[x] == -1:
defTemp = False
return defTemp
gunjanpatel /
Last active Nov 18, 2021
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

larsar / shared_folder_centos_virtualbox.txt
Created Jan 27, 2012
Mount shared folder on CentOS in VirtualBox
View shared_folder_centos_virtualbox.txt
# The VirtualBox documentation[1] for how to install guest additions
# for Linux on a virtual host is somewhat messy. So here is what
# I did to make it work.
# Install the packages required
yum update
yum install gcc kernel-devel make
ascv /
Last active Nov 2, 2021
A simple python calculator to demo recursive descent parsing. Execute the script to use the calculator. It accepts only well formed input. Use parentheses to specify operator precedence.
exp ::= term | exp + term | exp - term
term ::= factor | factor * term | factor / term
factor ::= number | ( exp )
class Calculator():
def __init__(self, tokens):
self._tokens = tokens
self._current = tokens[0]
View detect-dark-mode.js
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
// dark mode
// to watch for changes:
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
console.log(`changed to ${e.matches ? "dark" : "light"} mode`)
MrKioZ / Simple CSS
Created Nov 19, 2019
My first css page
View Simple CSS
<!DOCTYPE html>
<title>Internet Jobs</title>
<style type="text/css">
::selection {
background: #ffb7b7; /* WebKit/Blink Browsers */
::-moz-selection {
background: #ffb7b7; /* Gecko Browsers */