Skip to content

Instantly share code, notes, and snippets.

View motin's full-sized avatar

Motin motin

View GitHub Profile
@motin
motin / phpjavabridge-apache-poi-example-code.php
Created July 30, 2013 18:49
Example code using the Java library Apache POI (http://php-java-bridge.sourceforge.net/pjb/webapp.php) to manipulate ppt-files (PHPPowerPoint can only create, not manipulate files). Uses Java/PHP bridge (http://php-java-bridge.sourceforge.net/pjb/how_it_works.php)
<?php
require_once("http://localhost:8080/GapcmsJavaBridge/java/Java.inc");
// fake paths for gist
$sourceDataPpt = APP_PATH . "/includes/source_data.ppt";
$uploadedPpt = APP_PATH . "/upload/foo_data.ppt";
try {
@motin
motin / server.R
Created September 3, 2018 00:36 — forked from ncarchedi/server.R
Dynamically append arbitrary number of inputs (Shiny)
library(shiny)
shinyServer(function(input, output) {
output$allInputs <- renderUI({
# Get value of button, which represents number of times pressed (i.e. number of inputs added)
inputsToShow <- input$appendInput
# Return if button not pressed yet
if(is.null(inputsToShow) || inputsToShow < 1) return()
# Initialize list of inputs
@motin
motin / commit-using-commitizen-in-new-iterm-window.scpt
Last active January 10, 2023 18:57
Add as SourceTree custom action: Open in Seperate Window (checked), Script to run `/path/to/commit-using-commitizen-in-new-iterm-window.sh` (this path MUST NOT contain spaces due to long-standing SourceTree bug https://jira.atlassian.com/browse/SRCTREE-2150), Parameters: `$REPO`
on run argv
set repoPath to (item 1 of argv)
tell application "iTerm"
set newWindow to (create window with default profile)
tell current session of newWindow
write text "cd " & quoted form of repoPath & " && npx git-cz"
end tell
end tell
end run
df1 = pd.DataFrame([
{"url": "a", "Foo": '=C$2:C2', "bar": 'Cat'},
{"url": "b", "Foo": '=C$2:C3', "bar": 'Mouse'},
{"url": "c", "Foo": '=C$2:C2', "bar": 'Dog'},
{"url": "d", "Foo": '=C$2:C5', "bar": 'Eagle'},
{"url": "e", "Foo": 'C$2:C6', "bar": 'Albatross'},
{"url": "f", "Foo": '', "bar": 'Albatross'},
])
def df_add_col(df):
@motin
motin / Dockerfile
Last active March 6, 2022 18:07
Run "git clone https://gist.github.com/cca880c647263eb5e98d9f1e0d60a3c5.git replicate-docker-issue-21950 && bash replicate-docker-issue-21950/replicate-docker-issue-21950.sh" to replicate https://github.com/docker/docker/issues/21950
FROM busybox
COPY . /
@motin
motin / hmac-sign.php
Last active September 15, 2021 21:41
PHP equivalent of hmac.new(secret, message, hashlib.sha256).hexdigest()
<?php
$message = 'Message';
$secret = 'secret';
print "php\n";
print hash_hmac('SHA256', $message, $secret) . "\n";
<?php
use Propel\Generator\Model\Column;
use Propel\Generator\Model\Database;
use Propel\Generator\Model\ForeignKey;
use Propel\Generator\Model\Index;
use Propel\Generator\Model\Table;
use Propel\Generator\Model\Unique;
use Propel\Generator\Model\PropelTypes;
use Propel\Generator\Model\ColumnDefaultValue;
Could not map contract ID '@mozilla.org/sharepicker;1' to CID {1201d357-8417-4926-a694-e6408fbedcf8} because no implementation of the CID is registered.
Experiment add-on background.js messaging-system-personalization-experiment-1-addon-treatment@mozilla.org background.js:22:9
Object { config: {…} }
background.js:23:9
Checking study eligibility background.js:70:11
Eligible background.js:53:15
Writing hard-coded score threshold 5000 background.js:86:11
Object { permanentPrivateBrowsing: false }
background.js:72:11
Fetching "cfr-ml-model" bucket contents directly from the remote settings server endpoint background.js:103:17
@motin
motin / AppJson.php
Created December 19, 2017 14:47
Handle JSON decoding/encoding app-wide in a specific manner
<?php
/**
* Handle JSON decoding/encoding app-wide in a specific manner
*
* Class AppJson
*/
class AppJson
{
@motin
motin / openwpm-fork-on-mac.md
Last active May 3, 2019 12:47
Running a fork of OpenWPM on your Mac

Running a fork of OpenWPM on your Mac Natively

OpenWPM is a brilliant piece of software for running large-scale website crawls using a remotely controlled browser (Firefox) instead of utilizing a classic web scraping tool. It can easily be extended to collect any sort of data that a browser can collect and comes pre-configured to collect information regarding fingerprinting-related Javascript executions and first/third-party website traffic. The resulting data ends up in a SQLite database (for smaller data collections) or stored in JSON format in the cloud (for large scale data collections).

This document has moved to https://github.com/mozilla/OpenWPM/wiki/Running-OpenWPM-natively-on-macOS