Skip to content

Instantly share code, notes, and snippets.

@ngugijames
ngugijames / officetophp.php
Created January 11, 2016 10:42
DOC, DOCX, PPT, XLSX to TXT in PHP
/*determine th file extension
$file_name = $_FILES['image']['name'];
$file_extn = end(explode(".", strtolower($_FILES['image']['name'])));
if($file_extn == "doc" || $file_extn == "docx"){
}elseif($file_extn == "rtf"){
}
*/
@christopherstott
christopherstott / import_zsh_history_to_fish.js
Created January 23, 2016 23:39
Import ZSH history to Fish
'use strict';
const fs = require('fs');
const expandHomeDir = require('expand-home-dir');
const zshHistoryRaw = fs.readFileSync(expandHomeDir('~/.zsh_history'), 'utf8');
const zshHistoryLines = zshHistoryRaw.split('\n');
const transformLine = line => {
try {
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 7, 2025 02:57
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@bmaupin
bmaupin / build-openssl.sh
Last active December 11, 2023 20:24
Build openssl (with SSLv2/3 support for security testing)
#!/bin/bash
# Cache sudo password
sudo -v
# Get latest OpenSSL 1.0.2 version from https://openssl.org/source/
# v1.1.0 seems to have removed SSLv2/3 support
openssl_version=1.0.2k
# Install build dependencies
anonymous
anonymous / firefox_android.md
Created March 3, 2016 07:48

Подборка минимально необходимых настроек и дополнений для Firefox под Android.

Установка

Последнюю версию Firefox можно было бы найти тут, на официальном FTP:
android-api-9 - для Android 2.3
android-api-11 - для Android 3.0 и выше.
android-x86 - для Android устройств с процессором x86
Но к сожалению Mozilla во время выкладывает новые версии только в Google Play Market, с FTP как повезет. Поэтому свежие версии можно взять из каталога на FTP куда выкладывают сборки в процессе разработки tinderbox-builds:
(выбирайте версию с большим номером)

@gorhill
gorhill / gist:ef1b62d606473c68d524
Last active February 16, 2023 21:17
Disqus comments widget: on-demand
! Title: Disqus click-to-load
# Copy-paste the static filters below into your "My filters" pane in the
# dashboard.
# Purpose is to load Disqus comments on demand only, so that no connection
# to `disqus.com` occurs by default when you land on a site which uses
# Disqus comments widget.
# Not connecting to Disqus by default is a good thing for such a
# ubiquitous server as `disqus.com`, which can be used to build a
@bmhatfield
bmhatfield / .profile
Last active January 29, 2025 11:11
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@zackseuberling
zackseuberling / googleforms2slack.gs
Last active March 22, 2017 01:12 — forked from andychase/googleforms2slack.gs
Google Forms Slack Notification
// Google Forms Slack Notification
// Andy Chase <github.com/andychase>
// License: CC0 1.0 Universal <creativecommons.org/publicdomain/zero/1.0>
// Install 1: This code goes in ( tools > script editor... ) of your google docs form
// Install 2: ( resources > current project triggers ) ( [onSubmit], [from Form], [On form submit] )
// Setup 1: Put your slack api url below
var POST_URL = "https://hooks.slack.com/services/";
function onSubmit(e) {
@deluan
deluan / README.md
Last active October 6, 2016 16:33
README for Checkman Simulator

Checkman Simulator

This plugin simulates Checkman functionality, allowing you to use all its plugins and configuring checks in external files. It downloads Checkman's plugins on demand, so you don't need to install Checkman itself.

Available check plugins: HTTP, GoCD, Concourse, Jenkins, Travis, Semaphore, Codeship, CircleCI, Airbrake, GitHub, Pivotal Tracker, TDDium and SnapCI.

To learn more about Checkman and its existing plugins, see:

@nalgeon
nalgeon / README.md
Last active September 10, 2020 21:21
Пример работы с подсказками DaData на PHP (через cUrl)

Подсказки на PHP

Для большинства PHP-приложений достаточно использовать jQuery-плагин. Он проще в подключении и красиво выглядит. Используйте прямую работу с API на PHP только в том случае, если вы твёрдо уверены, что jQuery-плагин не подходит.

https://github.com/hflabs/dadata-php