Skip to content

Instantly share code, notes, and snippets.

View the-cc-dev's full-sized avatar
💭
searching for inspiration.

Cat the-cc-dev

💭
searching for inspiration.
View GitHub Profile
@the-cc-dev
the-cc-dev / generate-ssh-key.sh
Last active January 25, 2021 18:53 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
#!/bin/bash
EMAIL="[email protected]"
ssh-keygen -t rsa -b 4096 -N '' -C "${EMAIL}" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "${EMAIL}" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "${EMAIL}" -f ~/.ssh/mozilla_rsa
#!/bin/sh
keylength=8
algo=$1
[[ "$algo" = "aes" ]] && keylength=16
[[ "$algo" = "3des" ]] && keylength=24
encfile=$(mktemp -t _encXXXXXX) && \
keyfile=$(mktemp -t _encXXXXXX) && \
dd if=/dev/urandom of="$keyfile" bs="$keylength" count=1 >/dev/null 2>&1 && \
@the-cc-dev
the-cc-dev / mysql-docker.sh
Created December 20, 2019 02:48 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@the-cc-dev
the-cc-dev / actions.php
Created December 17, 2019 02:44
snippets for wp themes
<?php
// Setup Theme
function theme_setup() {
/* * * * *
* Enable plugins to manage the document title
* http://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag
*/
add_theme_support('title-tag');
// unlike tweets using twitter web (use this on https://twitter.com/USERNAME/likes)
//
// @param {n} the number of likes to delete
// @param {maxWaitRetries} maximum number of times to try loading more likes when
// everything on the page has been unliked
const unlike = async (n, maxWaitRetries = 10) => {
let total = 0;
while(total < n) {
// get every like button on the page and click it
const likeButtons = await document.querySelectorAll('[data-testid="unlike"]');
@the-cc-dev
the-cc-dev / class_foxy_loadmore.php
Created December 17, 2019 01:52 — forked from foxy-develop/class_foxy_loadmore.php
class for create ajax load more button in wordpress
<?php
class Loadmore_Button {
public $article_wrapper = 'article-card';
public $post_per_load = 6;
public $button_text = 'Показать еще';
public $button_loading_text = 'Загрузка...';
public $button_data_attr = 'data-aos="fade-up"';
public $orderby = 'date';
public $article_class = '.all-news__item';
public $button_class = 'all-news__btn-more';
$(document).ready(() => {
$("#add_bookmark").click(() => {
// Mozilla Firefox Bookmark
window.sidebar && window.sidebar.addPanel(location.href, document.title,"");
// IE Favorite
window.external && window.external.AddFavorite(location.href, document.title);
// Opera Hotlist
if( window.opera && window.print ) {
this.title=document.title;
return true;
@the-cc-dev
the-cc-dev / font-vars.less
Last active August 12, 2019 20:17
less mixins
.font-vars() {
@font: {
@family: {
serif: serif;
sans: sans-serif;
deco: cursive;
}
@size: {
@the-cc-dev
the-cc-dev / README.md
Created January 21, 2019 10:56 — forked from watson/README.md
A list of search and replace unix commands to help make a node repository 'standard' compliant

The standard code style linter is a great tool by Feross - check it out!

Remove trailing semicolons:

find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/;$//' {} \;

Ensure space between function and opening bracket:

@the-cc-dev
the-cc-dev / .editorconfig
Last active December 17, 2019 01:29
OLD -- front-end dev files
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8