Skip to content

Instantly share code, notes, and snippets.

View rolandinsh's full-sized avatar
🧔
Remote developer (LEMP, Node.js, Neo4j [graph])

Rolands rolandinsh

🧔
Remote developer (LEMP, Node.js, Neo4j [graph])
View GitHub Profile
@soygul
soygul / youtube-upload.js
Last active April 14, 2024 19:52
YouTube video uploader using JavaScript and Node.js
// YouTube API video uploader using JavaScript/Node.js
// You can find the full visual guide at: https://www.youtube.com/watch?v=gncPwSEzq1s
// You can find the brief written guide at: https://quanticdev.com/articles/automating-my-youtube-uploads-using-nodejs
//
// Upload code is adapted from: https://developers.google.com/youtube/v3/quickstart/nodejs
const fs = require('fs');
const readline = require('readline');
const assert = require('assert')
const {google} = require('googleapis');
// ==UserScript==
// @name SS.com improver
// @description Makes ss.com bearable
// @match *://ss.com/*
// @match *://*.ss.com/*
// @match *://ss.lv/*
// @match *://*.ss.lv/*
// ==/UserScript==
function deleteElem(elem) {
@mingalevme
mingalevme / php-redis-custom-flags.sh
Created March 1, 2020 11:46
Installing PHP Redis extension inside PHP-Alpine-based Docker container
NPROC=$(getconf _NPROCESSORS_ONLN)
mkdir -p /usr/src/php/ext
cd /usr/src/php/ext
pecl bundle redis
docker-php-ext-configure redis --enable-redis-igbinary --enable-redis-lzf
docker-php-ext-install -j${NPROC} redis
cd -
@JeremyMorgan
JeremyMorgan / getbadguys.sh
Created February 8, 2020 04:35
Get a list of IP addresses trying to attack your CentOS server
#/usr/bin/bash
# strings to look for in our file
# Note: you could just parse the whole file. But if you put in a bad password your IP
# could end up on the bad guy list
declare -a badstrings=("Failed password for invalid user"
"input_userauth_request: invalid user"
"pam_unix(sshd:auth): check pass; user unknown"
"input_userauth_request: invalid user"
"does not map back to the address"
"pam_unix(sshd:auth): authentication failure"
@mlocati
mlocati / Enable-HyperV.ps1
Last active July 30, 2020 16:23
Enable or disable Hyper-V (to switch between VirtualBox and Docker for Windows, for example)
<#
To enable Hyper-V:
Enable-HyperV.ps1 $True
To disable Hyper-V:
Enable-HyperV.ps1 $False
Author: Michele Locati <michele@locati.it>
License: MIT
Source: https://gist.github.com/mlocati/bb146577785511b44412e2fb57f969a6
#>
@quicoto
quicoto / delete.js
Last active October 15, 2019 21:31
Delete Facebook Posts by year
/**
* HOW TO
* Replace XXXXXX by your username in the following url
* https://www.facebook.com/XXXXXX/allactivity?entry_point=privacy_settings&privacy_source=activity_log&log_filter=cluster_11&category_key=statuscluster
* Scroll down to a year.
* Important: you must scroll and see all the posts you want to delete before executing.
* The script will not auto scroll, will not auto load the posts.
*
* Set the year in the configuration.
* Copy the whole thing.
@insaurabh
insaurabh / preload-css-wordpress.php
Created May 10, 2019 06:49
Preload css in wordpress.
// preload css in wordpress
// add this code in child theme function.php
add_filter( 'style_loader_tag', 'preload_css', 10, 2 );
function preload_css( $html, $handle ){
$targetHanlde = array('zuhaus_mikado_child_style');
if( in_array( $handle, $targetHanlde ) ){
@edwinlee
edwinlee / Code.gs
Last active February 21, 2024 10:43
Sync a Google Sheets spreadsheet to a Firebase Realtime database
/**
* Copyright 2019 Google LLC.
* SPDX-License-Identifier: Apache-2.0
*/
function getEnvironment() {
var environment = {
spreadsheetID: "<REPLACE WITH YOUR SPREADSHEET ID>",
firebaseUrl: "<REPLACE WITH YOUR REALTIME DB URL>"
};
version: "3.7"
x-logging-elk: &logging-elk
# driver: json-file
driver: gelf
options:
gelf-address: udp://172.16.0.38:12201
labels: container_group
x-sentry-environment: &sentry-environment
MATCH (n:VideoTranscript {path:"/Users/ikwattro/dev/_transcript/Intro to Graph Databases Episode #6 - Continuing with Cypher-Kv_HP6C2qes.en.vtt"})-[:HAS_ANNOTATED_TEXT]->(a)
match (a)-[:CONTAINS_SENTENCE]->(s:Sentence)
with a, count(*) as nSentences
match (a)-[:CONTAINS_SENTENCE]->(s:Sentence)-[:HAS_TAG]->(t:Tag)
with a, s, count(distinct t) as nTags, (CASE WHEN nSentences*0.1 > 10 THEN 10 ELSE toInteger(nSentences*0.1) END) as nLimit
where nTags > 4
with a, s, nLimit
order by s.summaryRank
with a, collect({text: s.text, pos: s.sentenceNumber})[..10] as summary