Skip to content

Instantly share code, notes, and snippets.

View oganm's full-sized avatar
🤦‍♂️

B. Ogan Mancarcı oganm

🤦‍♂️
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 4, 2024 17:58
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@srvanderplas
srvanderplas / jqfp.js
Last active June 17, 2023 04:58
Shiny user fingerprint (md5 hash of browser characteristics) and ip address demo. The .R files are in the working directory ("./"), the .js files must be placed in ./www/js/ to be accessible. I wrote the R code, which I will release under the same WTF license as the jqfp.js library is released under.
// Browser fingerprinting is a technique to "mark" anonymous users using JS
// (or other things). To build an "identity" of sorts the browser is queried
// for a list of its plugins, the screen size and several other things, then
// hashes them. The idea is that these bits of information produce an unique
// "fingerprint" of sorts; the more elaborate the list of data points is, the
// more unique this fingerprint becomes. And you wouldn't even need to set a
// cookie to recognize this user when she visits again.
//
// For more information on this topic consult
// [Ars Technica](http://arstechnica.com/tech-policy/news/2010/05/how-your-web-browser-rats-you-out-online.ars)
#!/bin/bash
if [ $# -lt 2 ]; then
echo "format: git_cleanup <repo name> [-x/--expunge <directory 1> -l/--keeplatest <directory 2> ...]"
exit
fi
PROJ="$1"
shift
@timelyportfolio
timelyportfolio / Readme.md
Created February 24, 2015 16:33
igraph in DiagrammeR

In response to this tweet

@riannone @abresler @timelyportfolio this popped into my head last week, how hard would it be to dump an igraph or graphNEL into diagrammeR?

— Tim Triche, Jr. (@timtriche) February 24, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

I made this little Gist. It illustrates one way to git an igraph into DiagrammeR using grViz. One way to use igraph with mermaid can be seen in this Gist R ( igraph + DiagrammeR + pipeR +htmltools ) + JS ( mermaid.js + d3.js + dagre-d3.js ).

Full attribute customization will probably not be possible with these two

@facelessuser
facelessuser / ase.py
Last active August 29, 2015 14:16
ase
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import struct
import re
import sys
PY3 = sys.version_info >= (3, 0)
if PY3:
uchr = chr
@noamross
noamross / google_wordcloud.R
Created April 22, 2015 01:13
Create a wordcloud of your google search history
# Script to make a word cloud of your google searches. Get your google search
# history at http://history.google.com. This script assumes the JSON files
# exported are in a 'Searches' subfolder
library(jsonlite)
library(rlist)
library(magrittr)
library(stringi)
library(wordcloud)
library(tm)
@psychemedia
psychemedia / numbers2words.R
Created July 12, 2015 00:12
R function to convert numbers to words
#https://github.com/ateucher/useful_code/blob/master/R/numbers2words.r
numbers2words <- function(x){
## Function by John Fox found here:
## http://tolstoy.newcastle.edu.au/R/help/05/04/2715.html
## Tweaks by AJH to add commas and "and"
helper <- function(x){
digits <- rev(strsplit(as.character(x), "")[[1]])
nDigits <- length(digits)
if (nDigits == 1) as.vector(ones[digits])
@wch
wch / shim.R
Last active June 2, 2022 10:39
Shim system.file for htmlwidgets so that a dependent package can be used with devtools::load_all()
shim_system_file <- function(package) {
imports <- parent.env(asNamespace(package))
pkgload:::unlock_environment(imports)
imports$system.file <- pkgload:::shim_system.file
}
shim_system_file("htmlwidgets")
shim_system_file("htmltools")
# After the code above has been run, you can load an in-development package

The header format changed quite significantly in 4.8+. Here's what I have so far. Mostly found by comparing headers to the Sync Logs generated by HD Edition, which log game settings & more (SteamApps/common/Age2HD/Logs/%date%/SyncLog GameType etc.txt). Still lots of unknowns :'

struct aoe2recordHeader50 {
  float thousandSomething; // I've seen 1000, 1004, 1005, not sure what for.
  int thousand;
    /* Relevant strings for this space, not sure how they work yet:
      &mrefDlcOptions
      &refGameDataSet
    */
@bborgesr
bborgesr / shiny-reactive-R6-object.R
Created August 1, 2017 21:22
Uses the reactiveTrigger() construct in an R6 object class in order to make it useful in reactive settings, like a Shiny app (MWE included)
library(shiny)
reactiveTrigger <- function() {
counter <- reactiveVal( 0)
list(
depend = function() {
counter()
invisible()
},
trigger = function() {