Skip to content

Instantly share code, notes, and snippets.

View belachkar's full-sized avatar
💻
Freelance

Ali Belachkar belachkar

💻
Freelance
View GitHub Profile
@marioBonales
marioBonales / .bashrc
Created January 19, 2012 03:56
Default .bashrc for ubuntu
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@christopheretcheverry
christopheretcheverry / passport registration login
Created November 18, 2012 23:25
Using passport in node to register or create a user
app.use(passport.initialize());
app.use(passport.session());
passport.use(new LocalStrategy(
function(username, password, done) {
//Search for user
User.find({ where: {email: username} }).success(function(user) {
//If no user register a new one
@zmwangx
zmwangx / No longer able to make public gists secret.md
Last active July 16, 2024 09:59
No longer able to make public gists private — message to GitHub

We've been able to toggle visibility of gists since 2014 (https://github.com/blog/1837-change-the-visibility-of-your-gists), but I just noticed that I can no longer make public gists private. That is, when I edit private gists I still see the "Make Public" button, but not the other way round — there's only a "Delete" button when I edit public gists; the "Make Secret" which should be next to it (as shown in the screencast in the linked blog post) is nowhere to be found. I made a screenshot and a screencast demonstrating the issue, both of which are attached. Could you please confirm this issue? Was this an intentional change, and why? Thank you for your attention.

gist-unable-to-make-secret

![gist-unable-to-make-secret](https://cloud.githubusercontent.com/assets/4149852/16898407/c76db210-4c0b-11e6-9108-0450f1edebb4.gif)
@abritinthebay
abritinthebay / consoleColors.js
Last active July 17, 2024 21:18
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"
@idettman
idettman / add-to-existing-namespaces.js
Last active February 26, 2024 00:57
JavaScript: JSDoc Advanced Tips
/* https://leahayes.wordpress.com/2011/08/28/documenting-javascript-with-jsdoc3/
Namespaces can still be documented when a more abstract mechanism is used. @lends allows members to be added to an existing namespace:
*/
/**
* Root namespace
* @namespace root
*/
$namespace('root', /** @lends root **/ {
/**
POST https://firestore.googleapis.com/v1beta1/projects/firestore-fun/databases/(default)/documents:commit?key={YOUR_API_KEY}
{
"writes": [
{
"update": {
"name": "projects/firestore-fun/databases/(default)/documents/foo/bar",
"fields": {
"some-field": {
"stringValue": "some-value"

src: https://fdossena.com/?p=w10debotnet/index_1809.frag

MUSIC, TV, ...

Get-AppxPackage -AllUsers *zune* | Remove-AppxPackage
Get-WindowsPackage -Online | Where PackageName -like *MediaPlayer* | Remove-WindowsPackage -Online -NoRestart
# Additionally, you should remove Windows Media Player: go to Start > Settings > Apps > Manage optional features, and remove Windows Media Player

XBOX AND GAME DVR

Setup SSH for and push to multiple Git-hosting service accounts (including self-hosted) from scratch

Thanks to Rodney Lorrimar for Pushing to Multiple Git Repos

This example uses two GitHub accounts, and a self-hosted GitLab account (localhost:8092 for ssh).

The Github (another-user account) private repo has been arbitrarily chosen as the main repo for the project.

The mirrors are a separate Github (wellknownuser account) public project, and a Gitlab (dubioususer account) private group and project.

@belachkar
belachkar / MySQL.MD
Created September 10, 2019 15:58
MySQL Code Sheet

MySQL code sheet

Show Users

SELECT User, Host FROM mysql.user;

Create User

@belachkar
belachkar / How To Use Markdown.md
Last active October 28, 2019 21:09
كيفية تضمين الكود بالطريقة الصحيحة في المواضيع و التعليقات

كيفية تضمين الكود بالطريقة الصحيحة في المواضيع و التعليقات

لكي تسهل قرائة الكود و الاجابة عبر نسخه عوض لصق الصور
يكتب الكود على الشكل التالي :

```<Programming language>
Your code
```

Java